/* 
    写文件
*/
const fs = require('fs');
const path = require('path');

let strPath = path.join(__dirname, './abc.txt');

// fs.writeFile(strPath, '你好', 'utf8', (err, state) => {
//     if (!err) {
//         console.log('文件写入成功');
//     }
// });

/* let buf = Buffer.from('小潘，你好！！！');
fs.writeFile(strPath, buf, 'utf8', (err, state) => {
    if (!err) {
        console.log('写入成功');
    }
}); */



// 同步操作
fs.writeFileSync(strPath, '帅杰和小潘', 'utf8');